package com.chenyongjing.design.pattern.state.gper;

/**
 * @Author chen
 * @Date 2022/11/20 20:11
 */
public class UnLoginState extends UserState{

    @Override
    public void favorite() {
        this.switchToLogin();
        this.context.getState().favorite();
    }

    @Override
    public void comment(String comment) {
        this.switchToLogin();
        this.context.getState().comment(comment);
    }

    private void switchToLogin(){
        System.out.println("跳转到登录页");
        this.context.setState(this.context.STATE_LOGIN);
    }
}
